home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 038a / bas_int1.zip / CHGDRV2.BAS < prev    next >
BASIC Source File  |  1991-05-26  |  2KB  |  45 lines

  1. '===================================================================
  2. '   Quick Basic Forum
  3. '   Date : 25-Apr-91 18:39
  4. '   From : David Ellsworth
  5. 'Subject :  Setting Default Drive.
  6. '
  7. ' DOS Interrupt 21h (33 decimal) Function 0Eh (14) is the ticket.
  8. ' Run QB with the /L option.
  9. ' Provide a TYPE'd variable to pass data and declare the needed
  10. ' subroutine (or use '$INCLUDE: 'QB.BI') for a call to INTERRUPT.
  11. '===================================================================
  12. ' Eg.
  13.  TYPE RegType
  14.       ax    AS INTEGER
  15.       bx    AS INTEGER
  16.       cx    AS INTEGER
  17.       dx    AS INTEGER
  18.       bp    AS INTEGER
  19.       si    AS INTEGER
  20.       di    AS INTEGER
  21.       flags AS INTEGER
  22.  END TYPE
  23.  DECLARE SUB INTERRUPT (Intnum AS INTEGER, InReg AS RegType, OutReg AS
  24.                         RegType)
  25.  DIM InReg AS RegType, OutReg AS RegType
  26.   
  27. ' When you want to set a new default drive call the interrupt with the proper
  28. ' register settings.
  29. ' Eg.
  30.  
  31.  DriveNumber = 2:         'Set C:
  32.  InReg.ax = &HE00:        'Call function 0Eh
  33.  InReg.dx = DriveNumber:  'Zero based (A: = 0 through Z: = 25).
  34.  INTERRUPT &H21, InReg, OutReg
  35.   
  36. ' As a point of interest the last drive number is returned in the AL register.
  37.  LastDrive$ = CHR$((OutReg.ax AND 31) + 64) + ":"
  38. ' The last drive number in AL is 1 based (1 = A: through 26 = Z:).
  39.   
  40. ' To find the default drive you can use Function 19h.
  41.  InReg.ax = &H1900; (OutReg.ax and 31) = Current drive; 0 = A: - 25 = Z:
  42.  
  43. ' You can also find the default directory with Function 47h.
  44.  
  45.